Move a function for the compiler
authorJustin Burkett <justin@burkett.cc>
Wed, 5 Oct 2016 18:42:10 +0000 (14:42 -0400)
committerJustin Burkett <justin@burkett.cc>
Wed, 5 Oct 2016 18:42:10 +0000 (14:42 -0400)
which-key.el

index 681a2eb0fc71003aa845bc679d426dc504e4622e..ff9e46b58418f797594e376ac6cd0e5d42ccba22 100644 (file)
@@ -1219,6 +1219,26 @@ replacement occurs return the new STRING."
        (current-local-map) (kbd (which-key--current-key-string (car keydesc))))
       (intern (cdr keydesc))))
 
+(defun which-key--maybe-replace-key-based (string keys &optional title)
+  "KEYS is a string produced by `key-description'
+and STRING is the description that is possibly replaced using the
+`which-key-key-based-description-replacement-alist'. Whether or
+not a replacement occurs return the new STRING."
+  (let* ((alist which-key-key-based-description-replacement-alist)
+         (str-res (assoc-string keys alist))
+         (mode-alist (assq major-mode alist))
+         (mode-res (when mode-alist (assoc-string keys mode-alist)))
+         tmp-res)
+    (setq tmp-res
+          (cond (mode-res (cdr mode-res))
+                (str-res (cdr str-res))
+                (t string)))
+    (cond ((and (listp tmp-res) title)
+           (nth 1 tmp-res))
+          ((listp tmp-res)
+           (car tmp-res))
+          (t tmp-res))))
+
 (defun which-key--maybe-get-prefix-title (keys)
   "KEYS is a string produced by `key-description'.
 A title is possibly returned using
@@ -1244,26 +1264,6 @@ stiring is returned if no title exists."
      which-key--current-show-keymap-name)
     (t "")))
 
-(defun which-key--maybe-replace-key-based (string keys &optional title)
-  "KEYS is a string produced by `key-description'
-and STRING is the description that is possibly replaced using the
-`which-key-key-based-description-replacement-alist'. Whether or
-not a replacement occurs return the new STRING."
-  (let* ((alist which-key-key-based-description-replacement-alist)
-         (str-res (assoc-string keys alist))
-         (mode-alist (assq major-mode alist))
-         (mode-res (when mode-alist (assoc-string keys mode-alist)))
-         tmp-res)
-    (setq tmp-res
-          (cond (mode-res (cdr mode-res))
-                (str-res (cdr str-res))
-                (t string)))
-    (cond ((and (listp tmp-res) title)
-           (nth 1 tmp-res))
-          ((listp tmp-res)
-           (car tmp-res))
-          (t tmp-res))))
-
 (defun which-key--propertize-key (key)
   "Add a face to KEY.
 If KEY contains any \"special keys\" defined in